﻿using System;

namespace Entities
{
    [Serializable]
    public class Passenger
    {
        private string passengerID;
        private string password;
        private string name;
        private int age;
        private bool gender;
        private string creditNumber;
        private string email;
        private string address; 
        public Passenger()
        { }
        public Passenger(string passengerID, string password, string name, int age, bool gender, string creditNumber, string email, string address)
        {
            this.passengerID = passengerID;
            this.password = password;
            this.name = name;
            this.age = age;
            this.gender = gender;
            this.creditNumber = creditNumber;
            this.email = email;
            this.address = address;
        }
        public string PassengerID
        {
            get { return this.passengerID; }
            set
            {
                if (value == null)
                    throw new Exception("passengerID not allow nullvalue.");
                this.passengerID = value;
            }
        }
        public string Password
        {
            get { return this.password; }
            set { this.password = value; }
        }
        public string Name
        {
            get { return this.name; }
            set { this.name = value; }
        }
        public int Age
        {
            get { return this.age; }
            set { this.age = value; }
        }
        public bool Gender
        {
            get { return this.gender; }
            set { this.gender = value; }
        }
        public string CreditNumber
        {
            get { return this.creditNumber; }
            set { this.creditNumber = value; }
        }
        public string Email
        {
            get { return this.email; }
            set { this.email = value; }
        }
        public string Address
        {
            get { return this.address; }
            set { this.address = value; }
        }
        public override string ToString()
        {
            return this.passengerID + "; " + this.password + "; " + this.name + "; " + this.age + "; " + this.gender + "; " + this.creditNumber + "; " + this.email + "; " + this.address + "; ";
        }
        public override bool Equals(Object obj)
        {
            Passenger me = (Passenger)obj;
            bool ret = this.PassengerID.Equals(me.PassengerID);
            return ret;
        }
        public override int GetHashCode()
        {
            return this.PassengerID.GetHashCode();
        }

    }
}